Team backpropagate

Group Members:

Table of Contents

Introduction

The task of classifying images into different categories such as building, forest, mountain and sea is a popular application of computer vision. This type of image classification can be performed using machine learning algorithms that are trained on large datasets of labeled images.An image classification application is a type of artificial intelligence (AI) application that uses machine learning algorithms to automatically classify and categorize images based on their visual content. It's an essential tool for many industries that need to organize, sort and analyze large amounts of visual data, such as advertisment, travel agencies and social media.

1.Business Understanding

In this lab, Natural landscapes images using Intel Image Classification (CNN - Keras) Dataset will be categorized and classified:
URL:https://www.kaggle.com/code/vincee/intel-image-classification-cnn-keras/notebook

Natural landscapes image classification can be a useful technique for travel agencies to categorize and target their advertisements based on customers' interests in specific types of landscapes. Here are a few ways in the importance of image classification for the travel agency advertisements based on customers' interests in natural landscapes:

Forests: Image classification can be used to categorize images of forests based on factors such as tree species, foliage colors, and hiking or camping activities. This can be useful for creating targeted advertisements for customers who are interested in exploring forest landscapes and activities such as hiking or camping.

Mountains: Image classification can be used to categorize images of mountains based on factors such as height, scenery, and activities such as skiing or hiking. This can be useful for creating targeted advertisements for customers who are interested in mountain landscapes and activities such as skiing, snowboarding, or hiking.

sea: Image classification can be used to categorize images of seas based on factors such as location, water clarity, and activities such as fishing or boating. This can be useful for creating targeted advertisements for customers who are interested in visiting seas and exploring the natural landscapes and activities available.

buildings:Image classification can be used to identify and categorize images that showcase the cultural features of a destination, such as historical landmarks, museums, or local festivals. This can be useful for creating advertisements that highlight the unique cultural experiences that a travel destination has to offer.

By using image classification to categorize natural landscapes images based on customers' interests, travel agencies can create targeted advertisements that speak directly to potential customers and drive more bookings and revenue. This can help travel agencies to build strong customer relationships based on shared interests and values and stand out in a crowded marketplace. Accuracy in the prediction tasks can bring higher benefit to the travel agencies and It can help the customers find the destination they are looking for to spend a good time in there but wrong predictions usually would not be harmful. In the worst case, it causes a minor financial loss and wasting time.

2.Data Preparation

loading data and necessary library packages

in the original dataset existed classes are building, forest, glacier, mountain, sea and street due to saving time, memory and make them more recognizable and simpler I choosed building, forest, mountain and sea classes.

At first, I am loading the data by reading all the images in all folders and convert them to numpy array so I can see them as array and perfrom statistical normalization. then I am changing the color to the grayscale because our task is to regonize different landscape categories which are recognizable even without having colors and basicly we just need to classfy based on shape of the things and edges. changing to grayscale helps reduce the data to 1/3 size of RGB data. If I was working with the original classes, I need color to differentiate between mountain and glacier.Also our data should be normalized in order to have the same size pictures. in this way, different sizes, different light intensity and different spatial locations do not have any effect on classification

I reduced the size of images to (80*80) To reduce the number of primary features while keeping them in recognizable quality . Now I want to visualize some random pictures with their labels

3.Data Reduction

3.1 Data Normalization

at first we have to normalize our data. Image normalization can help reduce the impact of illumination variations on the image features. This is particularly important in tasks such as object recognition and detection, where lighting conditions can vary widely. Also, PCA feature extraction algorithms assumes that the input features are centered and have a unit variance. Normalizing the image data can help ensure that the features extracted from the image have these properties. Furthermore,Normalizing image data can help ensure that different images are comparable in terms of their pixel values. This is important when working with images that have different resolutions or dynamic ranges.

4. Dimensional reduction

4.1 Principle Components Analysis (PCA)

PCA is a linear dimensionality reduction method that identifies the principal components that capture the maximum variance in the data. These principal components are then used to transform the original data into a lower-dimensional space. PCA is a widely used method for reducing the dimensionality of high-dimensional datasets and is well-suited for datasets with a linear structure.

Questions:how varient is our data and how many features I need to extract to recover images in lower dimension?

This graph shows that lower dimension contains the main features of the image, such as edges which are essential for classification and recognition of things in images. increasing dimension adds more details to the image, which sometimes cannot be recognized by the human eye. here number of 1000 feature has been chosen and I want to investigate whether restored image is recognizable or not.

These are the Egien Vectors for number of 1000 components which show our converted dimension with the highest variance that I can classify my image data easier.

here 1000 eigenimages have been extracted using pca which contains images' basic features and 30.8 seconds is taken to extract all the requested features

Questions: is it possible to rebuilt and claasify the image in lower dimension using 1000 features?

this cell shows the eigen images in the eigen vectors coordinates

in this cell we transform our eigen images from eigen vector coordinates to the original coordinates

As a result, by reducing the dimension (reducing the number of features), the image can be restored and recognizable by human eye successfully.

Question: which method gives us the better resolution of our dataset images using same amount of features?

so let's investigate other methods

4.2 Randomized Principle Components Analysis (RPCA)

Randomized PCA is a variant of PCA that uses a randomized algorithm to identify the principal components. The randomized algorithm makes use of random projections to approximate the principal components of the data. This approach can be faster than traditional PCA, especially for high-dimensional datasets, while still producing accurate results.

This graph shows that lower dimension contains the main features of the image, such as edges which are essential for classification and recognition of things in images. increasing dimension adds more details to the image, which sometimes cannot be recognized by the human eye. here number of 1000 feature has been chosen randomly and I want to investigate whether restored image is recognizable or not.

here 1000 eigenimages have been extracted using rpca which contains images' basic features and 31.4 seconds is taken to extract all the requested features

this cell shows the eigen images in the rpca eigen vectors coordinates

We can see that our Full PCA and Randomized PCA methods have very close results (even the same quality to the human eye)

To compare the performance of PCA and Randomized PCA in representing images with fewer components, we can use a quantitative metric such as reconstruction error and K-nearest neighbors accuracy. The reconstruction error measures the difference between the original image and the image reconstructed using the reduced dimensional representation. A lower reconstruction error indicates a better representation of the image with fewer components. The K-nearest neighbors accuracy measures how accurate our methods can classify images in the same category as the nearest neighbor. our results show that randomized PCA is slightly better than PCA. In practice, Randomized PCA often produces similar results to traditional PCA while being faster and more memory-efficient. However, the performance of both methods can vary depending on the dataset and the specific application.

Question: As RPCA is more accurate than Full PCA, How good RPCA method is in finding other images in the same category using pairwise distance?

Our results show that although RPCA can recognize some of the same categories' pictures it is not very accurate for classifying all the pictures. So we need to investigate other methods to have better classification

4.3 DAISY

The daisy algorithm is a computer vision algorithm that is used to detect keypoints in an image.The algorithm works by first computing a scale-space representation of the image, which is a series of images at different scales. Then, for each pixel in each scale, the algorithm computes the difference of Gaussian (DoG) between adjacent scales. The DoG is a measure of the difference in intensity between two neighboring pixels in the image.The algorithm then looks for extrema in the DoG response, which are points where the DoG is either a maximum or a minimum with respect to both spatial and scale dimensions. These extrema are potential keypoints.

To eliminate unstable keypoints, the algorithm performs a series of tests based on the local contrast and edge responses at each keypoint. The remaining keypoints are then assigned an orientation based on the gradient directions of nearby pixels, and a descriptor is computed based on the local image gradients around the keypoint.

1008 features have been extracted using Daisy method

Daisy algorithm is so fast working with higher dimension. It took 31ms to extract features

Our results show that Daisy algorithm can recognize most of the same categories' pictures accurately

4.3-1 K-Nearest Neighbor Classification with each Feature Space

4.3-2 Daisy Nearest neighbor classifier crosstab

This graph shows corrolation between our data.also it can be seen that daisy algorithm could classify and recognize categorizes up to 70%. Most of the extracted features are relevant to the prediction task and it captures the most important information in the data. Because our purpose of doing this image processing is to have travel agency advertising I think daisy algorithm could achieve to a good accuracy of data because accuracy in our data is not very important and 70% match is good for our data.

4.4 Gradient Method

this image shows gradient of the Image, as you can see all the edges can be seen very accurately and the image is recognizable

4.5 Key point matching for DAISY features

4.6 Gabor kernel

4.6-1 Gabor kernel Nearest neighbor classifier crosstab

This graph shows that corrolation between our data. the gabor algorithm could classify and recognize categorizes up to 55% which is less than Daisy algorithm.This method does not able to discriminate between different classes or categories in the data and its prediction is so inaccurate.

5. Conclusion

Natural landscape image processing can be an effective tool for travel agencies looking to advertise their destinations to potential customers. By enhancing the beauty and visual impact of natural landscapes, image processing can help capture the attention of viewers and convey the unique features of a particular location. To better classify data, we need to reduce dimension in order to make process faster, improve the accuracy of predictive models, better visualization to make it easier to understand the relationships between variables .Our Image processing shows that Daisy dimensional reduction algorithm is computationally efficient and scalable to large datasets, making it practical for real-world applications. in our survey, Daisy shows accuracy of nearly 70% and has better performance in comparsion to other methods and works better for data analysis of travel agencies' advertisement.

Reference

[1] Lecture videos

[2] Dr. Larson github codes